//
//  LzwThreeDetailCell.m
//  NewHalfsugar
//
//  Created by 刘志武 on 16/1/7.
//  Copyright © 2016年 刘志武. All rights reserved.
//

#import "LzwThreeDetailCell.h"
#import "UIImageView+WebCache.h"
#import "LzwBaseLable.h"
#import "LzwBaseImageView.h"

@interface LzwThreeDetailCell ()

@property (nonatomic, retain) LzwBaseImageView *myThreeImage1;
@property (nonatomic, retain) LzwBaseImageView *myThreeImage2;

@property (nonatomic, retain) LzwBaseLable *myThreeLable1;
@property (nonatomic, retain) LzwBaseLable *myThreeLable2;

@end

@implementation LzwThreeDetailCell

-(void)dealloc{
    [_myThreeImage1 retain];
    [_myThreeImage2 release];
    [_myThreeLable1 release];
    [_myThreeLable2 release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self creatThreeView];
    }
    return self;
}

- (void)creatThreeView{
    
    //图片
    self.myThreeImage1 = [[LzwBaseImageView alloc]initWithFrame:CGRectMake(2 * WIDTH, 2 * WIDTH, 370 * WIDTH, 180 * WIDTH)];
    self.myThreeImage1.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.myThreeImage1];
    
    //喜爱图片
    self.myThreeImage2 = [[LzwBaseImageView alloc]initWithFrame:CGRectMake((375 - 20) / 2 * WIDTH - 70 * WIDTH, 230 * WIDTH, 20 * WIDTH, 20 * WIDTH)];
    self.myThreeImage2.image = [UIImage imageNamed:@"love.png"];
    [self.contentView addSubview:self.myThreeImage2];
    
    //描述
    self.myThreeLable1 = [[LzwBaseLable alloc]initWithFrame:CGRectMake(2 * WIDTH, 185 * WIDTH, 369 * WIDTH, 45 * WIDTH)];
    self.myThreeLable1.textColor = [UIColor lightGrayColor];
    self.myThreeLable1.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myThreeLable1.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myThreeLable1];
    
    //喜爱人数
    self.myThreeLable2 = [[LzwBaseLable alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 45 * WIDTH, 230 * WIDTH, 60 * WIDTH, 20 * WIDTH)];
    self.myThreeLable2.textColor = [UIColor lightGrayColor];
    self.myThreeLable2.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myThreeLable2.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myThreeLable2];
    
    [_myThreeImage1 release];
    [_myThreeImage2 release];
    [_myThreeLable1 release];
    [_myThreeLable2 release];
    
    
}

-(void)setModleThree:(LzwThreeDeModle *)modleThree{
    
    if (_modleThree != modleThree) {
        [_modleThree release];
        _modleThree = [modleThree retain];
    }
    self.myThreeLable1.text = self.modleThree.title;
    self.myThreeLable2.text = self.modleThree.likes;
    
    NSURL *url = [NSURL URLWithString:self.modleThree.pic];
    
    [self.myThreeImage1 sd_setImageWithURL:url placeholderImage:nil];
    
}


@end
